﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Windows.Media.Imaging;

namespace MeetingFinder
{
    public class Group<T> : IEnumerable<T>
    {
        private String GroupIconImageUri;
        public Group(string name, IEnumerable<T> items)
        {
            this.Title = name;
            this.Items = new List<T>(items);
            switch (Title)
            {
                case "Completed":
                    GroupIconImageUri = "Assets/Images/back.png";
                    break;
                case "Updated":
                    GroupIconImageUri = "Assets/Images/cancel.png";
                    break;
                case "Pending":
                    GroupIconImageUri = "Assets/Images/check.png";
                    break;
            }

        }

        public override bool Equals(object obj)
        {
            Group<T> that = obj as Group<T>;

            return (that != null) && (this.Title.Equals(that.Title));
        }

        public string Title
        {
            get;
            set;
        }

        public IList<T> Items
        {
            get;
            set;
        }

        public ImageSource GroupIcon
        {
            get
            {
                Uri uri = new Uri(GroupIconImageUri, UriKind.RelativeOrAbsolute);
                ImageSource imgSource = new BitmapImage(uri);

                return imgSource;
            }
            set
            {
            }
        }


        #region IEnumerable<T> Members

        public IEnumerator<T> GetEnumerator()
        {
            return this.Items.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.Items.GetEnumerator();
        }

        #endregion
    }
}
